package admin.agent;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.common.ResultData;
import com.filter.BaseController;

import beans.sys.UserBean;
import beans.user.UserSearch;
import beans.user.agentxh;
import beans.user.agentxhserach;
import beans.user.user;
import service.user.WXUserServiceImpl;

/**
 * 代理的会员
 * @author am
 *
 */@Controller
 @RequestMapping("/aguser")
 public class AguserController extends BaseController{
	 @Resource
	 private WXUserServiceImpl<user> wxUserServiceImpl;

	 @RequestMapping("/index")
	 public String Index() { 
		 return "admin/agentuser/aguser/index";
	 }

	 @RequestMapping("/getdata")
	 @ResponseBody
	 public void DataGrid(UserSearch model){
		 ResultData<List<user>> rd = new ResultData<>();
		 try{
			 rd.setPage(model.getPage());
			 UserBean u = (UserBean)getReq().getSession().getAttribute("user");
			 model.setAgentid(u.getId());
			 List<user> m = wxUserServiceImpl.queryAgentUserByList(model);

			 rd.setRows(m);
			 rd.setRecords(model.getPager().getRowCount());
			 rd.setTotal(model.getPager().getPageCount());
		 }
		 catch(Exception e){
			 e.printStackTrace();
		 }
		 responseJson(rd);
	 }
 }
